/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pkgabstract;

import javax.swing.JOptionPane;

/**
 *
 * @author sara
 */
public class Abstract {

    public static void main(String[] args) {
        String out1;
        int m,n=0;
        if(args.length==0)
        {
            out1="please input c(circle) or s(Square) or r(Rectange)";
            out1=JOptionPane.showInputDialog(null, out1);
            String out2="please input a number:";
            out2=JOptionPane.showInputDialog(null,out2);
            m=Integer.parseInt(out2);
            if(out1.equals("r"))
            {
                String out3="please input other number:";
                out3=JOptionPane.showInputDialog(null, out3);
                n=Integer.parseInt(out3);
            }
        }
        else
        {
            out1=args[0];
            m=Integer.parseInt(args[1]);
            if(out1.equals("r"))
                n=Integer.parseInt(args[2]);
        }
        if(out1.equals("c"))
        {
            Circle c=new Circle(m);
            JOptionPane.showMessageDialog(null, c.toString(),"result",JOptionPane.PLAIN_MESSAGE);
        }
        else if(out1.equals("s"))
        {
            Square s=new Square(m);
            JOptionPane.showMessageDialog(null, s.toString(), "result", JOptionPane.PLAIN_MESSAGE);
        }
        else 
        {
            Rectange r=new Rectange(m,n);
            JOptionPane.showMessageDialog(null, r.toString(), "result", JOptionPane.PLAIN_MESSAGE);
        }
    }
    
}
